import React from 'react'
import ReactDOM from 'react-dom'    
import  ListDeal from '../../component/ListDeal/ListDeal'//ListDeal
// import './css/Demo_ListDeal.css' 
class Demo_ListDeal extends React.Component {
    constructor(props) {
        super(props);
        this.state = { 
            legend : false , 
        };
    }
    listConfig = {
            title:'漏打卡申请单',
            data:[
                  {
                        icon:'./assets/time.png', 
                        name:'时间期限:',
                        itemStyle:{width:'80px'},    
                        type:'time',  
                        rule:{//上班时间
                             dlz:{//冬令制
                                    st:[10,1],//开始时间10月1号
                                    et:[5,31],//结束是5月31
                                    tm:['08:30-12:00',"14:30-18:00"]
                                },
                            xlz:{//夏令制
                                    st:[6,1],//开始时间6月1号
                                    et:[9,31],//结束是9月31
                                    tm:['08:30-12:00',"15:00-18:00"] 
                                },  
                        },
                        tms:0,//请假时长，保存取这个
                },
                    {
                        icon:'./assets/type.png', 
                        name:'请假类型:',
                        itemStyle:{width:'95px'}, 
                        type:'btn',
                        currentLev:'事假',
                        currentIndex:'0', 
                        btnClick:(data,index)=>{
                            data.data.map((item,i)=>{
                                if(i==index){
                                    item.class='normal active';
                                    data.currentLev =item.text;
                                    data.currentIndex = item.value;
                                }else{
                                    item.class ='normal'
                                }
                            }) 
                            this.setState({}) 
                        },
                        data:[ {
                            text:'事假', 
                        },{
                            text:'病假', 
                        },{
                            text:'婚假', 
                        },{
                            text:'丧假', 
                        }]
                    },
                    {
                        icon:'./assets/pic.png', 
                        name:'事由:',
                        itemStyle:{width:'95px'}, 
                        type:'input',
                        placeholder:'请填写事由',
                        rightStyle:{width:'100%',border:'0',textAlign:'right',padding:'10px'},
                        content:'',
                        inputChange:(e,data)=>{ 
                            data.content = e.target.value; 
                            this.setState({})
                        }
                    },
                  {
                    icon:'./assets/pic.png', 
                    name:'图片:',
                    nameStyle:{}, 
                    type:'file',  
                    data:[],//图片信息
                    uploadTool:[{
                        name:'附件',
                        img:'./assets/NewCommunication/arr.png',
                        imgStyle:{width:45,height:45},
                        accept:' ',
                        itemChange:(e,data)=>{
                            let item=e.target.files[0]; 
                           
                        },
                    } ],
                    deleteStyle:{color:'#107ADE',position:'absolute',right:'10'},
                    deleteFn:(id,data)=>{
                            let pa = {
                                    annexId: id
                                }
                        T.ajax({
                            f : 'json',
                            key : 'oaFileDelPath',
                            data:pa,
                            success : (result) => {
                                let list=[];
                                data.map((item,i)=>{
                                    if(item.id!=id){
                                        list.push(item);
                                    }
                                });
                                this.config.data[1].data=list;
                                this.setState({})
                                // this.setState({state:!this.state.state});
                            }
                        }); 
                    },
                },
                {
                    icon:'./assets/time.png', 
                    name:'时间期限:',
                    itemStyle:{width:'95px'}, 
                    type:'singleTime',  
                    tms:0,//请假时长，保存取这个
                },
              ]
    }
 
    
     componentWillMount = () => {
 
    } 
    componentDidMount = () => { 
    } 

    info={
        boxW:360,
    } 
    render() {
        return (
            <div  className="ListDemo"> 
               <ListDeal  listConfig={this.listConfig}  listData={this.listData}   ></ListDeal>
            </div>
        )
    }
} 
export default Demo_ListDeal 